package com.dominator.shiro;

import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;

import org.apache.shiro.web.filter.authc.FormAuthenticationFilter;
/**
 * 
 * @author gsh
 *
 */
public class AuthcFilter extends FormAuthenticationFilter  {  
	@Override
	public boolean onPreHandle(ServletRequest request, ServletResponse response, Object mappedValue) throws Exception {
		HttpServletRequest req = (HttpServletRequest)request;
		if(req!=null&&req.getQueryString()!=null){
			if("__query__".equals(req.getQueryString())||req.getQueryString().contains("__query__")||"1".equals(req.getParameter("__query__"))){
			   request.setAttribute("QUERY", "true");
			   //req.getSession().setAttribute("QUERY", "true");
			}
			
		}
		
		if(false)return super.isAccessAllowed(request, response, mappedValue) || onAccessDenied(request, response, mappedValue);
		return true;
    }
}
